<template>
  <div>
    <div @click="handleGroupClick" class="group-item">
      <div class="group-avatar">
        <Avatar :src="group.avatar" :type="TIM.TYPES.CONV_GROUP"/>
      </div>
      <div class="group-name">{{ group.name }}</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    group: {
      type: Object,
      required: true
    }
  },
  methods:{
    handleGroupClick() {
      const conversationID = `GROUP${this.group.groupID}`;
      this.$store.dispatch('checkoutConversation', conversationID);
    }
  }
}
</script>

<style scoped>
.group-item {
  display: flex;
  padding: 10px 20px;
  cursor: pointer;
}
.group-avatar,.group-avatar .el-avatar{
  width: 30px;
  height: 30px;
}
.group-name {
  color: #f7f7f8;
  line-height: 30px;
  padding-left: 10px;
  overflow: hidden;
  text-overflow:ellipsis;
}
</style>
